package org.example.est.controller;


import org.example.est.common.BaseController;
import org.example.est.service.AliPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * TODO(这里用一句话描述这个类的作用)
 *
 * @author jun
 * @date 2021/11/23
 */
@RestController
@Validated
public class AliPayController extends BaseController {

    @Autowired
    private AliPayService aliPayService;

    @GetMapping("/api/pay/aliPay")
    public void toAliPay(@NotNull(message = "订单编号不能为空") String orderNo) throws Exception{
        String result = aliPayService.paySubscription(orderNo);
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().write(result);
    }
}
